﻿@using TamoCRM.Core
@model TamoCRM.Web.Mvc.Areas.Admin.Models.Contacts.ContactCreateModel

@{
    ViewBag.Title = "Danh sách contact cho đội nhập";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";

    var channels = ViewBag.Channels;
    var lstChannels = new SelectList(channels, "ChannelId", "Name");

    var importExcels = ViewBag.ImportExcels;
    var lstImportExcels = new SelectList(importExcels, "ImportId", "FilePath");

    var lstSchools = new SelectList(ViewBag.Schools, "SchoolId", "Name");
    var lstStatusConnectTypes = new SelectList(ViewBag.StatusConnectTypes, "Id", "Name");
}

<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed');
        }
        catch (e) {

        }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="/Home">Trang chủ</a>
        </li>

        <li>
            <a href="javascript:void(0);">Danh mục</a>
        </li>
        <li class="active">Danh sách contact</li>
    </ul>
</div>

<div class="page-content">
    <div class="page-header">
        <h1>Danh sách contact cho đội nhập</h1>
    </div>
    <!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            @using (Ajax.BeginForm("FilterContactForImporter", "Contact", new AjaxOptions { HttpMethod = "GET" }, new { enctype = "multipart/form-data", @class = "form-horizontal", role = "form", id = "filter_contact_recovery_form" }))
            {
                @Html.AntiForgeryToken()
                <div class="form-group">
                    <div class="col-sm-12" id="alert">
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-1" style="width: 5%;">
                        Gói
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.DropDownList("Code", lstImportExcels, new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 13%;">
                        Ngày Import
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 10%;">
                        Đến ngày
                    </div>
                    <div class="col-xs-2">
                        <div class="clearfix">
                            @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                        </div>
                    </div>
                </div>
                <div class="space-6"></div>
                <div class="row">
                    <div class="col-xs-1" style="width: 5%;">
                        Kênh
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.DropDownList("Code", lstChannels, new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 13%;">
                        Ngày thu thập
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 10%;">
                        Đến ngày
                    </div>
                    <div class="col-xs-2">
                        <div class="clearfix">
                            @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                        </div>
                    </div>
                </div>
                <div class="space-6"></div>
                <div class="row">
                    <div class="col-xs-1" style="width: 5%;">
                        Trường
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.DropDownList("Name", lstSchools, new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 13%;">
                        Trạng thái kết nối
                    </div>
                    <div class="col-xs-3">
                        <div class="clearfix">
                            @Html.DropDownList("Name", lstStatusConnectTypes, new { @style = "width: 100%" })
                        </div>
                    </div>
                    <div class="col-xs-1" style="width: 10%;">
                        Loại contact
                    </div>
                    <div class="col-xs-2">
                        @Html.CheckBox("Name", true) Mới&nbsp;&nbsp;
                                            @Html.CheckBox("Name", false) Tái sử dụng
                    </div>
                </div>
                <div class="space-2"></div>
                <hr />
                <div class="space-2"></div>
                <button id="btnFilterContact" class="btn-primary" style="margin-bottom: 10px; float: right;">Lọc Contact</button>
                <div class="clearfix"></div>
                <div class="space-4"></div>
                <div class="row">
                    <div class="col-xs-12">
                        <table id="grid-table"></table>
                        <div id="grid-pager"></div>
                    </div>
                </div>
            }

            <!-- PAGE CONTENT ENDS -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</div>

<script type="text/javascript">
    var url = 'admin/api/contact/filterrecovery?users={0}&type={1}&levels={2}&statusMapId={3}&statusCareId={4}&day={5}&branchId={6}';
    var grid_selector = "#grid-table";
    var heades = ['Id', 'Họ và tên', 'SĐT', 'Email', 'Trường tốt nghiệp', 'Ngành đăng ký', 'Level', 'Nơi sống', 'Trường', 'Ghi chú', 'Người nhập', 'Ngày nhập'];
    var model = [
        { name: 'Id', index: 'Id', editable: false, sorttype: 'string', width: '0px' },
        { name: 'Fullname', index: 'Fullname', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Mobile', index: 'Mobile', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Email', index: 'Email', editable: false, sorttype: 'string', width: '70px' },
        { name: 'SchoolName', index: 'SchoolName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'MajorName', index: 'MajorName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Level', index: 'Level', editable: false, sorttype: 'string', width: '50px' },
        { name: 'LocationName', index: 'LocationName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Notes', index: 'Notes', editable: false, sorttype: 'string', width: '100px' },
        { name: 'ChannelName', index: 'ChannelName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'RegisteredDate', index: 'RegisteredDate', editable: false, sorttype: 'string', width: '60px' },
        { name: 'School', index: 'School', editable: false, sorttype: 'string', width: '60px' }
    ];

    $(document).ready(function () {
        var branchId = '@ViewBag.BranchId';
        setupGridWithoutEdit("#grid-table", "#grid-pager", url.format('', '@((int)TodayType.New)', '', '', $('#ddlDay').val(), branchId), "admin/api/contact/edit", "Id", "Danh sách Contact", heades, model);
    });
</script>
